<%@ page language="java" pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
${aier_doctype}
<html <s:property value="aier-html-xmlns" escape="false"/>>
<head>
<meta http-equiv="Content-Type" content="${aier_content_type}" />
<meta name="keywords" content="${aier_keyworks}" />
<meta name="description" content="${aier_description}" />
<title>${aier_title}</title>
<link rel="stylesheet" href="${aier_css_url}${aier_jqui_css}ui.css" />
<link rel="Stylesheet" href="${aier_css_url}jq/jq.css" />
<link rel="Stylesheet" href="${aier_css_url}jq/multiselect.css" />
<link rel="stylesheet" href="${aier_css_url}jc/chosen.css">
<link rel="stylesheet" href="${aier_css_url}social/module/jq-msg.css" />
<link rel="stylesheet" href="${aier_css_url}social/module/reset.css" />
<link rel="stylesheet" href="${aier_css_url}social/school/common.css" />
<link rel="stylesheet" href="${aier_css_url}social/school/smanage.css" />

<script type="text/javascript" src="${aier_js_url}j.js"></script>
<script type="text/javascript" src="${aier_js_url}b.js"></script>
<script type="text/javascript" src="${aier_js_url}${aier_jqui_js}ui.js"></script>
<script type="text/javascript" src="${aier_js_url}97/WdatePicker.js"></script>
<script type="text/javascript" src="${aier_js_url}jp/msg.js"></script>
<script type="text/javascript" src="${aier_js_url}jq/cn.js"></script>
<script type="text/javascript" src="${aier_js_url}jq/jq.js"></script>
<script type="text/javascript" src="${aier_js_url}lib/ja.js"></script>
<script type="text/javascript" src="${aier_js_url}jc/cj.js"></script>
<script type="text/javascript" src="${aier_js_url}lib/block.js"></script>
<script type="text/javascript" src="${aier_js_url}jq/multiselect.js"></script>
<script type="text/javascript"
	src="${aier_js_url}social/school/sclass.js"></script>
<script type="text/javascript">
	var global_suffix = "${aier_suffix}", global_url = "${aier_url}", global_uri = "${aier_uri}", global_urijs = "${aier_urijs}",
	   global_sid = "${sid}",global_tid = "${tid}";
</script>

</head>
<!-- 班级管理页面 -->
<body>

	<!-- 顶栏 -->
	<s:action name="userhomecomm_homeHead" namespace="/user"
		executeResult="true"></s:action>

	<!-- 正文 -->
	<div id="hfContent" class="ar-content">
		<div class="content-main">
			<!-- 学校名称栏 -->
			<s:action name="scomm_schoolMTitle" namespace="/school"
				executeResult="true"></s:action>
			<div class="main-content wrap-bg clearfix">
				<!-- 左侧栏 -->
				<s:action name="scomm_schoolMLeft" namespace="/school"
					executeResult="true"></s:action>
				<!-- 右侧内容 -->
				<div class="ae-right">
					<div class="right-main">
						<div class="right-main-top">
							<div class="binfo-title">
								<h3>班级管理</h3>
							</div>
							<div class="right-line"></div>
						</div>
						<div class="right-main-c">
							<div class="c-sel-line clearfix">
								<div style="margin-left: 200px;" class="line-head">班级查询：</div>
								<div class="line-body">
									<select id="classid" class="chosen">
										<option value="-1">所有班级</option>
										<c:forEach var="cls" items="${schoolClassList }">
											<option value="${cls.cid}">${cls.cname}</option>
										</c:forEach>
									</select>
								</div>
								<a id="scsearchBtn" href="javascript:;" class="cm-search-btn line-foot"></a>
							</div>
						</div>
						<div class="right-main-c clearfix">
							<a style="float: right;" id="scaddBtn" href="javascript:;"
								class="scadd-btn"></a>
						</div>
						<div class="right-main-down">
							<div class="down-inre">
								<table id="sClassesInfo"></table>
								<div id="sClassesPage"></div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<!-- footer copyright -->
		<s:action name="userhomecomm_homeFooter" namespace="/user"
			executeResult="true"></s:action>
		<!-- /footer copyright -->
	</div>

	<!-- 添加班级弹出层 -->
	<div id="scAddDiv" title="添加班级" style="display: none;">
		<div class="info-tab01">
			<table>
				<tr>
					<th class="gray6">班级名称：</th>
					<td style="width: 260px;"><input type="text" class="PY-input"
						id="cName">
					</td>
				</tr>
				<tr>
					<th class="gray6">管理教师：</th>
					<td style="width: 260px;"><select id="teacherTypes"
						style="width:187px;" multiple="multiple">
							<c:forEach var="teacher" items="${teacherList }">
								<option value="${teacher.tid}">${teacher.tname}</option>
							</c:forEach>
					</select>
					</td>
				</tr>
				<tr>
					<th class="gray6 s-profile">简介：</th>
					<td><textarea class="s-txtarea" id="desinfo"></textarea></td>
				</tr>
			</table>
		</div>
	</div>

	<!-- 删除弹出层 -->
	<div id="compPrompt" title="提示" style="display: none;">
		<span>确认删除吗？</span>
	</div>
</body>
<script type="text/javascript">
	$(".chosen").chosen();
	$("#tabs").tabs();
	//设置班级为下拉复选框
	$("#teacherTypes").multiselect({
		noneSelectedText : "请选择",
		selectedText : "已选中#个教师",
		selectedList : 2
	});

	$(function() {
		//添加班级弹出层
		$("#scAddDiv").dialog({
			//背景变暗
			modal: true,
			autoOpen : false,
			show : "fade",
	        hide : "fade",
			width : "610",
			height : "400",
			buttons: {
				"确定": function() {
					var teacheres = $('#teacherTypes').val();
					var teacheresNew = "";
					if(teacheres!=null){
						var teacheresNew = teacheres.toString();
					}
					if($("#cName").val().trim()==""){
					$().message("请输入班级名!");
						return			
					}
					var funadd = function(data){
						if (data.s == 1) {
							$().message("添加班级成功!");
							$("#sClassesInfo").trigger("reloadGrid");
						} else {
							$().message(data.error_info);
						}
					};
					exeAjax(ajaxUrl("${aier_url}${aier_urijs}schoolclasses_addClass${aier_suffix}"), funadd, 
					{"sid" :global_sid,
					 "teacheres" :teacheresNew,
					 "cname":$("#cName").val(),
					 "desinfo":$("#desinfo").val()});
				},"取消": function() {
					$( this ).dialog( "close" );
				}
			}
		});
		$("#scaddBtn").click(function() {
			$("#scAddDiv").dialog("open");
			return false;
		});
	});
	
	$("#scsearchBtn").click(function() {
		var cid = $('#classid  option:selected').val();
		jQuery("#sClassesInfo").jqGrid('setGridParam',{url:"${aier_url}${aier_urijs}schoolclasses_searchClassList${aier_suffix}?sid="+global_sid
			+"&cid="+cid,page:1}).trigger("reloadGrid");
		return false;
	});
</script>
</html>